< previous page page_371 next page >

Page 371
Aspect Ratios
For a region like a viewport or world window, the region's aspect ratio is defined as the ratio of the region's height to its width. A square always has an aspect ratio of 1 because its height and width are the same. A viewport with a height of 1 inch and a width of 2 inches has an aspect ratio of 1/2.
If a world window and a viewport have the same aspect ratio, the image displayed on the screen appears normally. If the world window and viewport have different aspect ratios, the image appears stretched or squashed. Figure 12.4 shows several world windows and viewports that have different aspect ratios.
In many programs, you do not want a picture to appear stretched or squashed. A mapping program, for example, would look quite strange if the user could stretch the map out of proportion. Judging distances in a stretched map would be difficult, especially if the map is stretched by different amounts at different times.
To prevent this sort of confusion, you must ensure that the viewport and world windows always have the same aspect ratio. When the user of your program wants to zoom in on part of the picture, you must be certain that the aspect ratios remain the same. Several different approaches you can take to achieve this goal are discussed in the following sections.
z0391-01.gif
Figure 12.4
World windows and viewports with different aspect ratios.

 
< previous page page_371 next page >